Skip to content

feat(sounds): W4 五类固定程序化音效与设备级设置 - #45

Draft
WardLu wants to merge 1 commit into
mainfrom
feat/growth-loop-w4-sounds
Draft

feat(sounds): W4 五类固定程序化音效与设备级设置#45
WardLu wants to merge 1 commit into
mainfrom
feat/growth-loop-w4-sounds

Conversation

@WardLu

@WardLu WardLu commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

重新实现 W4:五类固定程序化音效与设备级设置。PR 已 rebase 到 main@eb244cf,当前 head 为 912ae82

  • 音效引擎 src/learning-sounds.js:Web Audio 实时合成,固定配方、无随机;五类事件(action_completed / points_earned / try_again / points_deducted / reward_fulfilled),每类 2–3 个变体;同操作优先级、防叠加、连续点击节流、TTS 冲突静音、AudioContext 不可用时静默降级。
  • 设备级设置:总开关、总音量(默认 60%)、逐事件开关与变体选择、试听、重置默认;仅存设备 localStorage,不同步云端。
  • 主流程接入:加分/扣分/撤销/兑换/兑现触发对应事件;reward_fulfilled 仅在服务端确认“已兑现”后经 reconcileConfirmed 触发。
  • rebase 适配:保留 main 上学习包导航与旧积分恢复逻辑;音效 E2E 改为当前“学习 → 语文”入口。

本 PR 不含数据库迁移,不执行生产迁移、db pushmigration repair

Fresh local verification (912ae82)

  • npm run verify:通过;22 个测试文件、177 项测试通过,build/public/security/build-artifact checks 均通过。
  • npm run test:e2e:73 通过、1 跳过;跳过项为未配置本地真实 Supabase 的 cloud-real,PR CI 已在隔离 Supabase 中通过该路径。
  • npm run release:check:通过;生产探测因未设置 RELEASE_URL 跳过。
  • npm audit --audit-level=high:0 vulnerabilities。
  • 公开仓库增量 gate(origin/main...HEAD)与 git diff --check:通过。

GitHub checks (912ae82)

  • CI / verify:通过(首次 E2E 出现两个非 W4 测试的瞬时失败;原 run attempt 2 全量复跑通过)。
  • CodeQL / Shared Supabase Policy / Vercel Preview:全部通过。
  • PR 当前 MERGEABLE / CLEAN,仍保持 Draft。

Remaining merge gates

  • 等待独立 review;当前 GitHub reviews / review requests 均为空,作者自审不作为独立 review。
  • 真实设备听感/音量仍需代表性设备人工验收;自动化与浏览器录音仅覆盖固定配方、播放路径与降级边界。

Closes: SHA-6

@vercel

vercel Bot commented Aug 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shadow-mate Ready Ready Preview Aug 20, 2026 3:10am

重新实现 W4:五类固定程序化音效(action_completed /
points_earned / try_again / points_deducted / reward_fulfilled),
Web Audio 实时合成、固定配方、每类 2-3 个变体;设备级设置
(总开关、音量、逐事件开关与变体、试听、重置)仅存 localStorage,
不同步云端。接入主流程:加分/扣分/撤销/兑换/兑现;reward_fulfilled
仅在服务端确认“已兑现”后触发。含单元测试与 E2E 测试。

@WardLu WardLu left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA & Security 复审记录(PR #45,head 912ae82

结论:COMMENT review。当前认证账号是 PR 作者,GitHub 不允许作者对自己的 PR 提交 REQUEST_CHANGES/approval,因此本条不能计作形式独立 review;但审计发现一个 🟡 中危、发布阻塞的奖励兑现失败状态卡死缺陷。

阻塞项:src/learning-growth-loop-controller.js:347-352reconcileUnconfirmed() 未处理 event.type === "redemption_fulfill"。当服务端对兑现 RPC 返回终态 rejected/conflict(例如并发兑现、奖励已取消或权限/状态冲突)时,outbox 会变为 rejected,但本地 redemption 保持 status: "pending", fulfill_requested: true;UI 因而永久显示“兑现已请求”,没有可重试/恢复路径。独立复现:对精确 head 的 controller 入队兑现后让 transport 返回 rejected/learning_redemption_not_fulfillable,得到该快照与 rejected outbox。

建议:在 reconcileUnconfirmed()redemption_fulfill 增加显式分支;对 retryable 保留可重试语义,对 terminal rejected/conflict 清理或转换 fulfill_requested 并保存 sync_error,让 UI 提供明确重试/失败状态;补充 rejected、retryable、重复确认的 unit test。RPC 仍需继续依赖服务端 household membership/role 校验。

非阻塞项:GitHub CI / CodeQL / Shared Supabase Policy / Vercel checks 均通过;本地精确 head 的新增 unit 30/30、音效 E2E 7/7、check、security:check、build、build-artifact checks 通过。真实设备音量/听感/TTS 互斥仍是 W6 的独立人工验收门禁,浏览器试听件不等同真机证据。

const debit = next.ledger.find((entry) => entry.redemption_id === redemption.id);
if (debit && remote?.id) debit.redemption_id = remote.id;
}
} else if (event.type === "redemption_fulfill") {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the matching failure-state handling for this new redemption_fulfill success branch. reconcileUnconfirmed() below has no branch for this event, so a terminal rejection leaves fulfill_requested: true while the outbox is rejected; the UI cannot recover or retry. Please cover this path with a unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant